package com.unittec.drainage.provider.auth.util;

import java.util.Comparator;

import org.apache.commons.lang.ObjectUtils;

import com.unittec.drainage.provider.auth.entity.SysPermission;

public class SysPermissionComparator implements Comparator<SysPermission> {

    @Override
    public int compare(SysPermission o1, SysPermission o2) {
        if (!ObjectUtils.equals(o1.getMenuType(), o2.getMenuType())) {
            return o1.getMenuType() - o2.getMenuType();
        } else {
            return o1.getSortNo() - o2.getSortNo();
        }
    }
}
